/***************************************************
 @Name :        小铭同学
 @Time :        2025-09-03
 @Email :       LiaoMingWJ233@163.com
 @Comment :     温湿度 设备驱动
 @FileName :    hal_tem_hum.h
 @Version :     1.0
****************************************************/


#ifndef HAL_TEM_HUM_H
#define HAL_TEM_HUM_H

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>
#include <errno.h>
#include <string.h>

extern int tem_hum_init();
extern double tem_collect();
extern float hum_collect();
extern int tem_hum_read_int(const char *device, const char *filename, int *val);
extern int tem_hum_read_float(const char *device, const char *filename, float *val);
extern int tem_hum_close();

#define READ_TEM_HUM_TEMP "/sys/bus/iio/devices/%s/%s"

#define READ_TEM_HUM_DERIVCE "iio:device0"

#define READ_TEM_RAW "in_temp_raw"
#define READ_TEM_OFFSET "in_temp_offset"
#define READ_TEM_SCALE "in_temp_scale"

#define READ_HUM_RAW "in_humidityrelative_raw"
#define READ_HUM_OFFSET "in_humidityrelative_offset"
#define READ_HUM_SCALE "in_humidityrelative_scale"
#endif

#ifdef PLAT_MP1C

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>
#include <errno.h>
#include <string.h>

extern int tem_hum_init();
extern double tem_collect();
extern float hum_collect();
extern int tem_hum_read_int(const char *device, const char *filename, int *val);
extern int tem_hum_read_float(const char *device, const char *filename, float *val);
extern int tem_hum_close();

#define READ_TEM_HUM_TEMP "/sys/bus/iio/devices/%s/%s"

#define READ_TEM_HUM_DERIVCE "iio:device0"

#define READ_TEM_RAW "in_temp_raw"
#define READ_TEM_OFFSET "in_temp_offset"
#define READ_TEM_SCALE "in_temp_scale"

#define READ_HUM_RAW "in_humidityrelative_raw"
#define READ_HUM_OFFSET "in_humidityrelative_offset"
#define READ_HUM_SCALE "in_humidityrelative_scale"

#endif
